package com.ruoyi.common.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 读取项目相关配置
 * 
 * @author ruoyi
 */
@Component
@ConfigurationProperties(prefix = "ruoyi")
public class RuoYiConfig
{
    /** 项目名称 */
    private String name;

    /** 版本 */
    private String version;

    /** 版权年份 */
    private String copyrightYear;

    /** 实例演示开关 */
    private boolean demoEnabled;

    /** 上传路径 */
    private static String profile;

    /** 获取地址开关 */
    private static boolean addressEnabled;

    /** 验证码类型 */
    private static String captchaType;

    /**
     * 单文件上传默认最大值 50M，如果超过最大值，会抛出异常
     */
    private static int defaultMaxSize;

    /**
     * 图片、视频资源根目录
     */
    private static String mediaPath;

    /**
     * 文档地址
     */
    private static String documentPath;

    /**
     * 头像地址
     */
    private static String avatarPath;

    /**
     * 报告模板地址
     */
    private static String templatePath;

    /**
     * 临时曲线图存放位置
     */
    private static String chartPath;

    /** oo默认地址 */
    private static String ooFile;

    /**
     * 签名存放位置
     */
    private static String sign;


    public String getName()
    {
        return name;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    public String getVersion()
    {
        return version;
    }

    public void setVersion(String version)
    {
        this.version = version;
    }

    public String getCopyrightYear()
    {
        return copyrightYear;
    }

    public void setCopyrightYear(String copyrightYear)
    {
        this.copyrightYear = copyrightYear;
    }

    public boolean isDemoEnabled()
    {
        return demoEnabled;
    }

    public void setDemoEnabled(boolean demoEnabled)
    {
        this.demoEnabled = demoEnabled;
    }

    public static String getProfile()
    {
        return profile;
    }

    public void setProfile(String profile)
    {
        RuoYiConfig.profile = profile;
    }

    public static boolean isAddressEnabled()
    {
        return addressEnabled;
    }

    public void setAddressEnabled(boolean addressEnabled)
    {
        RuoYiConfig.addressEnabled = addressEnabled;
    }

    public static String getCaptchaType() {
        return captchaType;
    }

    public void setCaptchaType(String captchaType) {
        RuoYiConfig.captchaType = captchaType;
    }

    public static String getMediaPath() {
        return mediaPath;
    }

    public  void setMediaPath(String mediaPath) {
        RuoYiConfig.mediaPath = mediaPath;
    }

    public static String getDocumentPath() {
        return documentPath;
    }

    public  void setDocumentPath(String documentPath) {
        RuoYiConfig.documentPath = documentPath;
    }

    public  void setAvatarPath(String avatarPath) {
        RuoYiConfig.avatarPath = avatarPath;
    }

    public static String getTemplatePath() {
        return templatePath;
    }

    public  void setTemplatePath(String templatePath) {
        RuoYiConfig.templatePath = templatePath;
    }

    public static String getChartPath() {
        return chartPath;
    }

    public  void setChartPath(String chartPath) {
        RuoYiConfig.chartPath = chartPath;
    }

    /**
     * 获取导入上传路径
     */
    public static String getImportPath()
    {
        return getProfile() + "/import";
    }

    /**
     * 获取头像上传路径
     */
    public static String getAvatarPath()
    {
        return getProfile() + "/avatar";
    }

    /**
     * 获取下载路径
     */
    public static String getDownloadPath()
    {
        return getProfile() + "/download/";
    }

    /**
     * 获取上传路径
     */
    public static String getUploadPath()
    {
        return getProfile() + "/upload";
    }

    /**
     * 获取二维码路径
     */
    public static String getQrPath()
    {
        return getProfile() + "/qrcode";
    }

    public static String getOoFile() {
        return getProfile() + "/ooFile";
    }

    public static void setOoFile(String ooFile) {
        RuoYiConfig.ooFile = ooFile;
    }

    /**
     * 获取报告模板路径
     */
    public static String getTemPath() { return getProfile() + "/report/template"; }

    /**
     * 获取原始记录路径
     */
    public static String getOrginalPath() { return getProfile() + "/orginal"; }

    public static String getSign() {
        return getProfile() + "/sign";
    }

    public static void setSign(String sign) {
        RuoYiConfig.sign = sign;
    }
}
